<!DOCTYPE html>
<#include "/ftl/header.ftl">
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<#include "/ftl/menu.ftl">

<script type="text/javascript">
function add() {
	window.location.href = "../admin/add";
}

function del(a) {
		var r = window.confirm("确认删除？");
		if (r == true) {
			window.location.href = "../admin/delete?a="+a;
		}
}

function edit(id) {
	window.location.href = "../admin/edit?adminId="+id;

}

</script>
<body>
<div class="container">
			<div class="row">
				<div class="col-md-12">
					<ol class="breadcrumb">
						<li><a href="#">账号管理</a></li>
						<li class="active">人员列表</li>
					</ol>
				</div>
			</div>
		<div class="row">
			<div class="col-md-12">
				<div class="block">
					<div class="form-row">
                        <div class="col-md-11">
                        </div>
                        <div class="col-md-1">
                        <div>

							<@shiro.hasPermission name="user:add">
							<button class="btn btn-default btn-clean"
											type="button" onclick="add()">添加</button></div>
					     	</@shiro.hasPermission>

                    </div>
                    </div>
					<div class="content">
						<table class="table table-bordered table-striped table-hover">
							<thead>
								<tr>
									<th>序号</th>
									<th>用户名</th>
									<th>状态</th>
									<th>角色</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
							<#if userlist??>
								<#list userlist as userperson>
								<tr>
									<input type="hidden" name="id" value="${userperson.adminId}" />
									<td>${userperson_index+1}</td>
									<td>${userperson.adminName}</td>
									<td><#if (userperson.status)==1>正常<#else>禁用</#if></td>
									<td>${userperson.role.roleName}</td>
									<td>
										<#if userperson.adminName=='admin'>
										管理员角色不可修改
									</#if>
										<#if userperson.adminName!='admin'>
										<@shiro.hasPermission name="user:add">
										<button class="btn btn-default btn-clean"
											type="button" onclick="del(${userperson.adminId})">删除</button>
									</@shiro.hasPermission>
										<@shiro.hasPermission name="user:edit">
											<button class="btn btn-default btn-clean"
											type="button" onclick="edit(${userperson.adminId})">修改</button></td>
							     	</@shiro.hasPermission>
							        </#if>

								</tr>
							    </#list>
								</#if>
							</tbody>

						</table>

					</div>
				</div>

			</div>
		</div>
	</div>
	
</body>
</html>